﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace gpao2012
{
    public partial class listecataloguetemp : DevExpress.XtraEditors.XtraUserControl
    {
        public listecataloguetemp()
        {
            InitializeComponent();
        }

        private void listecataloguetemp_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'gpaogscofficielDataSet.operation' table. You can move, or remove it, as needed.
            this.operationTableAdapter.Fill(this.gpaogscofficielDataSet.operation);
            // TODO: This line of code loads data into the 'gpaogscofficielDataSet.machine' table. You can move, or remove it, as needed.
            this.machineTableAdapter.Fill(this.gpaogscofficielDataSet.machine);
            // TODO: This line of code loads data into the 'gpaogscofficielDataSet.phase_production' table. You can move, or remove it, as needed.
            this.phase_productionTableAdapter.Fill(this.gpaogscofficielDataSet.phase_production);
            // TODO: This line of code loads data into the 'gpaogscofficielDataSet.catalogue_temps' table. You can move, or remove it, as needed.
            this.catalogue_tempsTableAdapter.Fill(this.gpaogscofficielDataSet.catalogue_temps);
            // TODO: This line of code loads data into the 'gpaogscofficielDataSet.catalogue_temps' table. You can move, or remove it, as needed.
            this.catalogue_tempsTableAdapter.Fill(this.gpaogscofficielDataSet.catalogue_temps);

        }

        private void simpleButton4_Click(object sender, EventArgs e)
        {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string chemin = System.IO.Path.GetFullPath(saveFileDialog1.FileName) + ".pdf";
                gridControl1.ExportToPdf(chemin);
            }
        }

        private void simpleButton5_Click(object sender, EventArgs e)
        {
            if (saveFileDialog2.ShowDialog() == DialogResult.OK)
            {
                string chemin = System.IO.Path.GetFullPath(saveFileDialog1.FileName);
                gridControl1.ExportToRtf(chemin);
            }
        }

        private void simpleButton6_Click(object sender, EventArgs e)
        {
            if (saveFileDialog3.ShowDialog() == DialogResult.OK)
            {
                string chemin = System.IO.Path.GetFullPath(saveFileDialog1.FileName);
                gridControl1.ExportToXlsx(chemin);
            }
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
               try
            {
                this.Validate();
                this.cataloguetempsBindingSource.EndEdit();
                this.catalogue_tempsTableAdapter.Update(this.gpaogscofficielDataSet.catalogue_temps);
                this.barstatustext.ForeColor = System.Drawing.Color.Lime;
                barstatustext.Text = "Enregistrement éffectué";

            }
            catch (System.Exception ex)
            {
                this.barstatustext.ForeColor = System.Drawing.Color.Red;
                barstatustext.Text = "Erreur";
            }
        
        }
    }
}